﻿// MyNewCP.cpp : 此文件包含 "main" 函数。程序执行将在此处开始并结束。
//

#include "pch.h"
#include <iostream>
#include <ctime>
using namespace std;
struct mod {//声明一个结构模型
	int n;
	char text[10];
};

int main()
{
	//cout << "Hello World!" << endl;//输入hellow world
	//cout << "你好！\n";
	///*typedef short int wchar_t;*/
	//int age = 120;
	//int times = 3;
	//int a;
	//int all = age * times;
	//cout << "欢迎来到C++" << endl;
	//cout << "请输入一个整数:";
	//cin >> a;//输入 >>
	//cout << "您输入的是:" << a << endl;//输出 <<

	///*cout << dec << a << ' '
	//	<< oct << a << ' '
	//	<< hex << a << endl;*/

	//	//////////////////////////////////////////////////////////////以下为字节测试
	//	//cout << "type: \t\t" << "************size**************" << endl;
	//	//cout << "bool: \t\t" << "所占字节数：" << sizeof(bool);
	//	//cout << "\t最大值：" << (numeric_limits<bool>::max)();
	//	//cout << "\t\t最小值：" << (numeric_limits<bool>::min)() << endl;
	//	//cout << "char: \t\t" << "所占字节数：" << sizeof(char);
	//	//cout << "\t最大值：" << (numeric_limits<char>::max)();
	//	//cout << "\t\t最小值：" << (numeric_limits<char>::min)() << endl;
	//	//cout << "signed char: \t" << "所占字节数：" << sizeof(signed char);
	//	//cout << "\t最大值：" << (numeric_limits<signed char>::max)();
	//	//cout << "\t\t最小值：" << (numeric_limits<signed char>::min)() << endl;
	//	//cout << "unsigned char: \t" << "所占字节数：" << sizeof(unsigned char);
	//	//cout << "\t最大值：" << (numeric_limits<unsigned char>::max)();
	//	//cout << "\t\t最小值：" << (numeric_limits<unsigned char>::min)() << endl;
	//	//cout << "wchar_t: \t" << "所占字节数：" << sizeof(wchar_t);
	//	//cout << "\t最大值：" << (numeric_limits<wchar_t>::max)();
	//	//cout << "\t\t最小值：" << (numeric_limits<wchar_t>::min)() << endl;
	//	//cout << "short: \t\t" << "所占字节数：" << sizeof(short);
	//	//cout << "\t最大值：" << (numeric_limits<short>::max)();
	//	//cout << "\t\t最小值：" << (numeric_limits<short>::min)() << endl;
	//	//cout << "int: \t\t" << "所占字节数：" << sizeof(int);
	//	//cout << "\t最大值：" << (numeric_limits<int>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<int>::min)() << endl;
	//	//cout << "unsigned: \t" << "所占字节数：" << sizeof(unsigned);
	//	//cout << "\t最大值：" << (numeric_limits<unsigned>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<unsigned>::min)() << endl;
	//	//cout << "long: \t\t" << "所占字节数：" << sizeof(long);
	//	//cout << "\t最大值：" << (numeric_limits<long>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<long>::min)() << endl;
	//	//cout << "unsigned long: \t" << "所占字节数：" << sizeof(unsigned long);
	//	//cout << "\t最大值：" << (numeric_limits<unsigned long>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<unsigned long>::min)() << endl;
	//	//cout << "double: \t" << "所占字节数：" << sizeof(double);
	//	//cout << "\t最大值：" << (numeric_limits<double>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<double>::min)() << endl;
	//	//cout << "long double: \t" << "所占字节数：" << sizeof(long double);
	//	//cout << "\t最大值：" << (numeric_limits<long double>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<long double>::min)() << endl;
	//	//cout << "float: \t\t" << "所占字节数：" << sizeof(float);
	//	//cout << "\t最大值：" << (numeric_limits<float>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<float>::min)() << endl;
	//	//cout << "size_t: \t" << "所占字节数：" << sizeof(size_t);
	//	//cout << "\t最大值：" << (numeric_limits<size_t>::max)();
	//	//cout << "\t最小值：" << (numeric_limits<size_t>::min)() << endl;
	//	//cout << "string: \t" << "所占字节数：" << sizeof(string) << endl;
	//	//// << "\t最大值：" << (numeric_limits<string>::max)() << "\t最小值：" << (numeric_limits<string>::min)() << endl;  
	//	//cout << "type: \t\t" << "************size**************" << endl

	//	/*for (int i=0 ; i < 10; i++)
	//	{
	//		cout << "次数:"; cout << i; cout << "次击打木桩" << endl;
	//	}*/
	//	//srand(time(0));
	//	////随机数练习
	//	//for (int i = 0; i < 10; i++)
	//	//{
	//	//	cout << rand() <<"嘤嘤嘤"<< endl;
	//	//	cout << rand() << endl;
	//	//}
	//show();
	//show(2);
	//show(4, 5.6);
	//show(8, 12.34, 50L);
	//cout << "--------------------------------"<<endl;
	//int *birthday = new int[3];
	//birthday[0] = 6;
	//birthday[1] = 24;
	//birthday[2] = 1940;
	//
	//cout << birthday[0] << endl;
	//cout << birthday[1] << endl;
	//cout << birthday[2] << endl;
	//delete[] birthday;
	//cout << "数组长度为："<<sizeof(*birthday) << endl;
	//cout << "--------------------------------" << endl;
	//int aaa = 123;
	//int& bbb = aaa;
	//aaa--;
	//cout << "引用类型结果：" << bbb << endl;
	//cout << "原变量结果：" << aaa << endl;
	//bbb = 0;
	//cout << "引用类型结果：" << bbb << endl;
	//cout << "原变量结果：" << aaa << endl;
	///*a(999);
	//a(12, 12);*/

	//static mod data = { 123,"China" };
	//func3(data);
	//func4(data);
int totalYear = 76;//中国人平均寿命
int once = 3;//一天玩手机的时间
int oneYear = 365;//一年天数，粗略计算排除闰年
int totalPlay = 0;
int totalServive = 0;

for (int i=totalYear; i>0; i--)
{
	for(int j = oneYear;  j>0; j--)
	{
		totalPlay += once;
		totalServive ++;
	}
}
int days = totalPlay/24;
int years = days / 365;
cout << "中国人的平均寿命是76岁，假设你一天有3个小时在看手机，以下是你的数据"<< endl;
cout << "您生活的总天数：" << totalServive << endl;
cout << "您玩手机的总小时数：" << totalPlay << endl;
cout << "您玩手机的总天数（向下取整）:" << days << endl;
cout << "您玩手机的总年数（向下取整）:" << years << endl;
cout << "假设说你能活到76岁,你的一生中有整整" << years <<"年的时间什么都没做都在看手机!"<< endl;


	return 0;//返回值为0
}//main函数结尾
//int fun1(int x, int y) {//正常函数
//	return  x * 2;
//}
//int fun2(int x, int) {//不表明实参的命名
//	return x;
//}
//void show(int first, float second, long third) {//了解默认机制
//	cout << first << first << second << second << third << third << endl;
//}
////根据参数区别函数
//void a(int i) {
//	cout << "输入:" << i << " 调用单参数函数" << endl;
//}
//void a(int i, int y) {
//	cout << "输入:" << i << "和" << y << " 调用单参数函数" << endl;
//}
//
//void func3(mod p) {
//	cout << "原函数:" << endl;
//	cout << p.n << endl;
//	cout << p.text << endl;
//}
//void func4(mod& p) {
//	cout << "引用函数:" << endl;
//	cout << p.n << endl;
//	cout << p.text << endl;
//}


// 运行程序: Ctrl + F5 或调试 >“开始执行(不调试)”菜单
// 调试程序: F5 或调试 >“开始调试”菜单

// 入门提示: 
//   1. 使用解决方案资源管理器窗口添加/管理文件
//   2. 使用团队资源管理器窗口连接到源代码管理
//   3. 使用输出窗口查看生成输出和其他消息
//   4. 使用错误列表窗口查看错误
//   5. 转到“项目”>“添加新项”以创建新的代码文件，或转到“项目”>“添加现有项”以将现有代码文件添加到项目
//   6. 将来，若要再次打开此项目，请转到“文件”>“打开”>“项目”并选择 .sln 文件
